<%-- 
    Document   : User
    Created on : 24.07.2011, 15:46:16
    Author     : Valentina
--%>
<%@page import="java.util.ResourceBundle"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<c:set var="language" value="${not empty param.language ? param.language : not empty language ? language : pageContext.request.locale}" scope="session" />
<fmt:setLocale value="${language}" />
<fmt:setBundle basename="Messages"/>


<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="default.css" rel="stylesheet" type="text/css" />
        <title><fmt:message key="page.text.user.title"/></title>
    </head>
    <body>

        <jsp:include page="/WEB-INF/frontend/commons/header.jspf"></jsp:include>

            <table width="740" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td>
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td><img src="images/spacer.gif" alt="" width="100" height="30" /></td>
                            </tr>
                            <tr>
                                <td class="title"><fmt:message key="page.text.user.title"/></td>
                            </tr>

                            <tr>
                                <td>
                                    <ul class="error">
                                    <c:forEach var="error" items="${myErrors}" >
                                        <li> ${error}</li>

                                    </c:forEach>
                                </ul>

                                <ul class="success">                                   
                                    <c:forEach var="success" items="${mySuccesMsg}" >
                                        <li> ${success}</li>
                                    </c:forEach>
                                </ul>
                            </td>
                        </tr>

                        <tr>
                            <td>
                                <a href="UserPrepareUpdateServlet"><fmt:message key="page.text.adduser"/></td>
                            </td>
                        </tr>
                        <tr>

                        <table class="border_table">
                            <thead>
                                <tr>
                                    <td><fmt:message key="page.text.table.nr"/></td>
                                    <td><fmt:message key="page.text.table.name"/></td>
                                    <td><fmt:message key="page.text.table.login"/></td>
                                    <td><fmt:message key="page.text.table.update"/></td>
                                    <td><fmt:message key="page.text.table.delete"/></td>
                                </tr>
                            </thead>
                            <tbody>
                                <c:forEach var="user" items="${users}" varStatus="status">
                                    <tr>
                                        
                                        <td>${status.count + pageNumber}</td>
                                        <td>${user.name}</td>
                                        <td>${user.login}</td>
                                        <td><a href="UserPrepareUpdateServlet?id=${user.id}"><fmt:message key="page.text.table.update"/></a></td>
                                        <td><a href="UserDeleteServlet?id=${user.id}" onclick="return confirm('<fmt:message key="page.text.message.delete"/>')"><fmt:message key="page.text.table.delete"/></a></td>
                                    </tr>
                                </c:forEach>
                            </tbody>
                        </table>

                        <table>
                            <tr>
                                
                                <td colspan="2">
                                <c:if test="${prevLink!=null}"><a href="${prevLink}"><fmt:message key="page.text.previous"/></a> |</c:if>
                                <c:if test="${nextLink!=null}"><a href="${nextLink}"><fmt:message key="page.text.next"/></a></c:if>
                                
                                </td>
                            </tr>
                        </table>
            </tr>   

        </table>
    </td>
</tr>


</table>

<jsp:include page="/WEB-INF/frontend/commons/footer.jspf"></jsp:include>

</body>
</html>